Optimal. Leaf size=128 \[ -\frac {b (f g-e h)^2 p q x}{3 f^2}-\frac {b (f g-e h) p q (g+h x)^2}{6 f h}-\frac {b p q (g+h x)^3}{9 h}-\frac {b (f g-e h)^3 p q \log (e+f x)}{3 f^3 h}+\frac {(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.10, antiderivative size = 128, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 3, integrand size = 26, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.115, Rules used = {2442, 45, 2495}
\begin {gather*} \frac {(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h}-\frac {b p q (f g-e h)^3 \log (e+f x)}{3 f^3 h}-\frac {b p q x (f g-e h)^2}{3 f^2}-\frac {b p q (g+h x)^2 (f g-e h)}{6 f h}-\frac {b p q (g+h x)^3}{9 h} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 45
Rule 2442
Rule 2495
Rubi steps
\begin {align*} \int (g+h x)^2 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right ) \, dx &=\text {Subst}\left (\int (g+h x)^2 \left (a+b \log \left (c d^q (e+f x)^{p q}\right )\right ) \, dx,c d^q (e+f x)^{p q},c \left (d (e+f x)^p\right )^q\right )\\ &=\frac {(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h}-\text {Subst}\left (\frac {(b f p q) \int \frac {(g+h x)^3}{e+f x} \, dx}{3 h},c d^q (e+f x)^{p q},c \left (d (e+f x)^p\right )^q\right )\\ &=\frac {(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h}-\text {Subst}\left (\frac {(b f p q) \int \left (\frac {h (f g-e h)^2}{f^3}+\frac {(f g-e h)^3}{f^3 (e+f x)}+\frac {h (f g-e h) (g+h x)}{f^2}+\frac {h (g+h x)^2}{f}\right ) \, dx}{3 h},c d^q (e+f x)^{p q},c \left (d (e+f x)^p\right )^q\right )\\ &=-\frac {b (f g-e h)^2 p q x}{3 f^2}-\frac {b (f g-e h) p q (g+h x)^2}{6 f h}-\frac {b p q (g+h x)^3}{9 h}-\frac {b (f g-e h)^3 p q \log (e+f x)}{3 f^3 h}+\frac {(g+h x)^3 \left (a+b \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{3 h}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.11, size = 157, normalized size = 1.23 \begin {gather*} \frac {6 b e \left (3 f^2 g^2-3 e f g h+e^2 h^2\right ) p q \log (e+f x)+f x \left (6 a f^2 \left (3 g^2+3 g h x+h^2 x^2\right )-b p q \left (6 e^2 h^2-3 e f h (6 g+h x)+f^2 \left (18 g^2+9 g h x+2 h^2 x^2\right )\right )+6 b f^2 \left (3 g^2+3 g h x+h^2 x^2\right ) \log \left (c \left (d (e+f x)^p\right )^q\right )\right )}{18 f^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 0.18, size = 0, normalized size = 0.00 \[\int \left (h x +g \right )^{2} \left (a +b \ln \left (c \left (d \left (f x +e \right )^{p}\right )^{q}\right )\right )\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.29, size = 207, normalized size = 1.62 \begin {gather*} -b f g^{2} p q {\left (\frac {x}{f} - \frac {e \log \left (f x + e\right )}{f^{2}}\right )} - \frac {1}{2} \, b f g h p q {\left (\frac {f x^{2} - 2 \, x e}{f^{2}} + \frac {2 \, e^{2} \log \left (f x + e\right )}{f^{3}}\right )} - \frac {1}{18} \, b f h^{2} p q {\left (\frac {2 \, f^{2} x^{3} - 3 \, f x^{2} e + 6 \, x e^{2}}{f^{3}} - \frac {6 \, e^{3} \log \left (f x + e\right )}{f^{4}}\right )} + \frac {1}{3} \, b h^{2} x^{3} \log \left (\left ({\left (f x + e\right )}^{p} d\right )^{q} c\right ) + \frac {1}{3} \, a h^{2} x^{3} + b g h x^{2} \log \left (\left ({\left (f x + e\right )}^{p} d\right )^{q} c\right ) + a g h x^{2} + b g^{2} x \log \left (\left ({\left (f x + e\right )}^{p} d\right )^{q} c\right ) + a g^{2} x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 275 vs.
\(2 (123) = 246\).
time = 0.36, size = 275, normalized size = 2.15 \begin {gather*} -\frac {6 \, b f h^{2} p q x e^{2} + 2 \, {\left (b f^{3} h^{2} p q - 3 \, a f^{3} h^{2}\right )} x^{3} + 9 \, {\left (b f^{3} g h p q - 2 \, a f^{3} g h\right )} x^{2} + 18 \, {\left (b f^{3} g^{2} p q - a f^{3} g^{2}\right )} x - 3 \, {\left (b f^{2} h^{2} p q x^{2} + 6 \, b f^{2} g h p q x\right )} e - 6 \, {\left (b f^{3} h^{2} p q x^{3} + 3 \, b f^{3} g h p q x^{2} + 3 \, b f^{3} g^{2} p q x + 3 \, b f^{2} g^{2} p q e - 3 \, b f g h p q e^{2} + b h^{2} p q e^{3}\right )} \log \left (f x + e\right ) - 6 \, {\left (b f^{3} h^{2} x^{3} + 3 \, b f^{3} g h x^{2} + 3 \, b f^{3} g^{2} x\right )} \log \left (c\right ) - 6 \, {\left (b f^{3} h^{2} q x^{3} + 3 \, b f^{3} g h q x^{2} + 3 \, b f^{3} g^{2} q x\right )} \log \left (d\right )}{18 \, f^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 286 vs.
\(2 (112) = 224\).
time = 1.36, size = 286, normalized size = 2.23 \begin {gather*} \begin {cases} a g^{2} x + a g h x^{2} + \frac {a h^{2} x^{3}}{3} + \frac {b e^{3} h^{2} \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )}}{3 f^{3}} - \frac {b e^{2} g h \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )}}{f^{2}} - \frac {b e^{2} h^{2} p q x}{3 f^{2}} + \frac {b e g^{2} \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )}}{f} + \frac {b e g h p q x}{f} + \frac {b e h^{2} p q x^{2}}{6 f} - b g^{2} p q x + b g^{2} x \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )} - \frac {b g h p q x^{2}}{2} + b g h x^{2} \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )} - \frac {b h^{2} p q x^{3}}{9} + \frac {b h^{2} x^{3} \log {\left (c \left (d \left (e + f x\right )^{p}\right )^{q} \right )}}{3} & \text {for}\: f \neq 0 \\\left (a + b \log {\left (c \left (d e^{p}\right )^{q} \right )}\right ) \left (g^{2} x + g h x^{2} + \frac {h^{2} x^{3}}{3}\right ) & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 585 vs.
\(2 (123) = 246\).
time = 3.48, size = 585, normalized size = 4.57 \begin {gather*} \frac {{\left (f x + e\right )} b g^{2} p q \log \left (f x + e\right )}{f} + \frac {{\left (f x + e\right )}^{2} b g h p q \log \left (f x + e\right )}{f^{2}} + \frac {{\left (f x + e\right )}^{3} b h^{2} p q \log \left (f x + e\right )}{3 \, f^{3}} - \frac {2 \, {\left (f x + e\right )} b g h p q e \log \left (f x + e\right )}{f^{2}} - \frac {{\left (f x + e\right )}^{2} b h^{2} p q e \log \left (f x + e\right )}{f^{3}} - \frac {{\left (f x + e\right )} b g^{2} p q}{f} - \frac {{\left (f x + e\right )}^{2} b g h p q}{2 \, f^{2}} - \frac {{\left (f x + e\right )}^{3} b h^{2} p q}{9 \, f^{3}} + \frac {2 \, {\left (f x + e\right )} b g h p q e}{f^{2}} + \frac {{\left (f x + e\right )}^{2} b h^{2} p q e}{2 \, f^{3}} + \frac {{\left (f x + e\right )} b h^{2} p q e^{2} \log \left (f x + e\right )}{f^{3}} + \frac {{\left (f x + e\right )} b g^{2} q \log \left (d\right )}{f} + \frac {{\left (f x + e\right )}^{2} b g h q \log \left (d\right )}{f^{2}} + \frac {{\left (f x + e\right )}^{3} b h^{2} q \log \left (d\right )}{3 \, f^{3}} - \frac {2 \, {\left (f x + e\right )} b g h q e \log \left (d\right )}{f^{2}} - \frac {{\left (f x + e\right )}^{2} b h^{2} q e \log \left (d\right )}{f^{3}} - \frac {{\left (f x + e\right )} b h^{2} p q e^{2}}{f^{3}} + \frac {{\left (f x + e\right )} b g^{2} \log \left (c\right )}{f} + \frac {{\left (f x + e\right )}^{2} b g h \log \left (c\right )}{f^{2}} + \frac {{\left (f x + e\right )}^{3} b h^{2} \log \left (c\right )}{3 \, f^{3}} - \frac {2 \, {\left (f x + e\right )} b g h e \log \left (c\right )}{f^{2}} - \frac {{\left (f x + e\right )}^{2} b h^{2} e \log \left (c\right )}{f^{3}} + \frac {{\left (f x + e\right )} b h^{2} q e^{2} \log \left (d\right )}{f^{3}} + \frac {{\left (f x + e\right )} a g^{2}}{f} + \frac {{\left (f x + e\right )}^{2} a g h}{f^{2}} + \frac {{\left (f x + e\right )}^{3} a h^{2}}{3 \, f^{3}} - \frac {2 \, {\left (f x + e\right )} a g h e}{f^{2}} - \frac {{\left (f x + e\right )}^{2} a h^{2} e}{f^{3}} + \frac {{\left (f x + e\right )} b h^{2} e^{2} \log \left (c\right )}{f^{3}} + \frac {{\left (f x + e\right )} a h^{2} e^{2}}{f^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.35, size = 225, normalized size = 1.76 \begin {gather*} \ln \left (c\,{\left (d\,{\left (e+f\,x\right )}^p\right )}^q\right )\,\left (b\,g^2\,x+b\,g\,h\,x^2+\frac {b\,h^2\,x^3}{3}\right )+x^2\,\left (\frac {h\,\left (a\,e\,h+2\,a\,f\,g-b\,f\,g\,p\,q\right )}{2\,f}-\frac {e\,h^2\,\left (3\,a-b\,p\,q\right )}{6\,f}\right )+x\,\left (\frac {3\,a\,f\,g^2+6\,a\,e\,g\,h-3\,b\,f\,g^2\,p\,q}{3\,f}-\frac {e\,\left (\frac {h\,\left (a\,e\,h+2\,a\,f\,g-b\,f\,g\,p\,q\right )}{f}-\frac {e\,h^2\,\left (3\,a-b\,p\,q\right )}{3\,f}\right )}{f}\right )+\frac {\ln \left (e+f\,x\right )\,\left (b\,p\,q\,e^3\,h^2-3\,b\,p\,q\,e^2\,f\,g\,h+3\,b\,p\,q\,e\,f^2\,g^2\right )}{3\,f^3}+\frac {h^2\,x^3\,\left (3\,a-b\,p\,q\right )}{9} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________